<?php
$sql = <<<'EOD'
CREATE TABLE IF NOT EXISTS `users` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(32) NOT NULL,
  `password` varchar(128) NOT NULL,
  `email` varchar(128) NOT NULL,
  `status` enum('active','confirmation','inactive','suspended') CHARACTER SET ascii COLLATE ascii_bin NOT NULL DEFAULT 'confirmation',
  PRIMARY KEY (`id`),
  KEY `status` (`status`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;

EOD;
/**
 * @todo insert users; possible sources:
 * - the rdb component
 * - user input via UI
 */

$command = Yii::app()->rdb->createCommand($sql);
$command->execute();
$command->getPdoStatement()->closeCursor();

$event->data = 'Table `users` created';
